using UnityEngine;
/// <summary>
/// 羽毛球，箭矢类头朝运动方向
/// </summary>
public class FaceRigidDirection : MonoBehaviour
{
    [SerializeField]
    Rigidbody _rigidbody;
    void Start()
    {
        _rigidbody ??= GetComponent<Rigidbody>();
    }
    private void OnEnable()
    {
        transform.rotation = default;
    }
    private void FixedUpdate()
    {
        if (_rigidbody.velocity.magnitude > 0.1f)
        {
            transform.rotation = Quaternion.LookRotation(_rigidbody.velocity);
        }
    }

}
